package com.hopu.erp.controller;


import com.hopu.erp.entity.PageEntity;
import com.hopu.erp.entity.Role;
import com.hopu.erp.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api
@RestController
public class RoleController {

    @Autowired
    private RoleService roleService;

    @ApiOperation("分页查询角色")
    @GetMapping("/roles/page")
    public ResponseEntity<PageEntity<Role>> findRolesPage(@RequestParam(value = "current",required = false,defaultValue = "1")
                                                                      Integer current){
        PageEntity<Role> page = roleService.findRolesPage(current);
        return ResponseEntity.ok(page);
    }
}
